<?php

// deal with sending email

function validate_mail_form() {
  $form_ok = TRUE;
  $error_msgs[] = 'Some of your entries were invalid. Please check the following:';
  // status must be chosen
  if ($_POST['status'] == "--Choose--") {
    $error_msgs[] = 'Please specify your status.';
  }
  // name must exist
  if ( empty($_POST['name'])) {
      $error_msgs[] = 'Please give your name.';
  }
  // email address must be exist and valid 
  if (! eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['email'])))) {
      $error_msgs[] = 'Please give a valid email address.';
  }

  // message must exist 
  if (empty($_POST['message'])) {
      $error_msgs[] = 'Please give a message you want to send.';
  }
  return $error_msgs;
}


?>

